package com.example.demo.bean;

import org.springframework.stereotype.Component;

@Component
public class UserInfo {        //用于表单提交
    private String username;
    private String password;
    private String mail;
    private String code;

    public User toUser() {             //将这些属性给user
        User user = new User(username, password, mail);
        return user;
    }

    /*可以在controller层进行测试!
    UserInfo userInfo=new UserInfo("2","3","4","123");
           User user=userInfo.toUser();
           */
    public UserInfo(String username, String password, String mail, String code) {
        this.username = username;
        this.password = password;
        this.mail = mail;
        this.code = code;
    }

    public UserInfo() {
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return "UserInfo{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", mail='" + mail + '\'' +
                ", code='" + code + '\'' +
                '}';
    }
}
